<admintpl file="header" />
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="#">{$info.phone_mob}的推广情况</a></li>
        <a class="btn btn-primary" href="{:U('Popularize/index')}">返回上一页</a>
    </ul>
    <form class="well form-search" method="post" action="{:U('Popularize/memberlist')}" id="form1">
        关键字：
        <input type="text" name="keyword" style="width: 200px;" value="{$keyword|default=''}" placeholder="请输入手机号">
        时间：
        <input type="text" name="start_time" class="js-datetime" value="{$start_time|default=''}" style="width: 120px;" autocomplete="off">-
        <input type="text" class="js-datetime" name="end_time" value="{$end_time|default=''}" style="width: 120px;" autocomplete="off">
        <input type="hidden" name="store_id" value="{$info.user_id}">

        <input type="submit" class="btn btn-primary" value="搜索" onclick="return index()"/>
        <a class="btn btn-danger" href="{:U('Popularize/memberlist',array('store_id'=>$info['user_id']))}">清空</a>
    </form>
    <form class="well form-search" method="post">
        <div class="form-group">
            <label>注册人数：</label>
            {$total}人
            <label>订单数：</label>
            {$countOrder}个
            <label>已完成订单数：</label>
            {$finishOrderTotal}个
            <label>订单金额：</label>
            {$totalOrder}元
            <label>完成订单金额：</label>
            {$finishOrderTotal}元
        </div>
    </form>
    <table class="table table-bordered table-hover table-striped" id="dataTables-date">
        <thead>
        <tr>
            <th>手机号</th>
            <th>注册时间</th>
            <th>归属店铺</th>
            <th>是否为推广人</th>
            <th>注册途径</th>
            <th>下单订单数</th>
            <th>完成订单数</th>
            <th>订单金额</th>
            <th>已完成订单金额</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
            <volist name="list" id ="sto">
                <tr>
                    <td>{$sto.phone_mob}</td>
                    <td>{$sto.reg_time|date="Y-m-d H:i:s",###}</td>
                    <td>{$info.phone_mob}</td>
                    <td>
                        <if condition="$sto.is_promoters eq 1">
                            是
                        <else/>
                        否
                        </if>
                    </td>
                    <td>
                        <if condition="$sto.refer_type eq 1">
                            分享注册
                        <elseif condition="$sto.refer_type eq 2"/>
                            心愿单分享注册
                        <else/>
                            普通注册
                        </if>
                    </td>
                    <td>{$sto.countOrder}</td>
                    <td>{$sto.finishOrderCount}</td>
                    <td>{$sto.totalOrder}</td>
                    <td>{$sto.finishOrderTotal}</td>
                    <td>
                        <a href="javascript:;" class="btn btn-primary qr_code" data-id="{$sto.user_id}">查看订单详情</a>
                    </td>
                </tr>
            </volist>
        </tbody>
    </table>

</div>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__PUBLIC__/layer/layer.js"></script>
<script>
    $(".qr_code").click(function(){
        var dataId = $(this).attr('data-id');
        var url = "{:U('Popularize/orderList')}";

        $.post(url,{
            user_id:dataId
        },function(data){
            var res = JSON.parse(data);
            if(res.code == -1){
                layer.msg('订单信息暂无！');
                return false;
            }
            var str = "    <table class=\"table table-hover table-bordered table-list\">\n" +
                "        <thead>\n" +
                "        <tr>\n" +
                "            <th>用户名</th>\n" +
                "            <th>订单号</th>\n" +
                "            <th>商家名称</th>\n" +
                "            <th>商品名称</th>\n" +
                "            <th>商品单价</th>\n" +
                "            <th>商品税费</th>\n" +
                "            <th>规格</th>\n" +
                "            <th>折扣价</th>\n" +
                "            <th>订单折扣价</th>\n" +
                "            <th>合计金额</th>\n" +
                "            <th>订单状态</th>\n" +
                "            <th>下单时间</th>\n" +
                "            <th>归属店铺</th>\n" +
                "        </tr>\n" +
                "        </thead>\n" +
                "        <tbody>";
            $.each(res.data,function(index,item){
                str += " <tr>\n" +
                    "                <td>"+item.buyer_name+"</td>\n" +
                    "                <td>"+item.order_sn+"</td>\n" +
                    "                <td>"+item.seller_name+"</td>\n" +
                    "                <td>"+item.goods_name+"</td>\n" +
                    "                <td>"+item.price+"</td>\n" +
                    "                <td>"+item.tax_price+"</td>\n" +
                    "                <td>"+item.specification+"</td>\n" +
                    "                <td>"+item.discount+"</td>\n" +
                    "                <td>"+item.order_amount+"</td>\n" +
                    "                <td>"+item.goods_amount+"</td>\n" +
                    "                <td>"+item.status_value+"</td>\n" +
                    "                <td>"+item.add_time+"</td>\n" +
                    "                <td>"+item.s_name+"</td>\n" +
                    "            </tr>";
            })

            str += "</tobody></table>";
            layer.open({
                type: 1,
                skin: 'layui-layer-rim', //加上边框
                area: ['1100px','700px'], //宽高
                content: str
            });
        })
    })
</script>

</body>
</html>
